Econometrics and Data Science by Tshepo Chris Nokeri

Econometrics and Data Science by Tshepo Chris Nokeri

Author:Tshepo Chris Nokeri
Language: eng
Format: epub
ISBN: 9781484274347
Publisher: Apress


Listing 5-5Loading Data

Table 5-2South Africa’s Macroeconomic Data

Date

urban_pop

gni_per_capita

gdp_growth

life_exp

2020-01-01

39946775.0

5410.0

-6.959604

NaN

2019-01-01

39149715.0

6040.0

0.152583

64.131

2018-01-01

38348227.0

5750.0

0.787056

63.857

2017-01-01

37540921.0

5410.0

1.414513

63.538

2016-01-01

36726640.0

5470.0

0.399088

63.153

Table 5-2 shows that there are missing values in the data. Listing 5-6 replaces the missing values with the mean value (this is done for each variable in the data).df["urban_pop"] = df["urban_pop"].fillna(df["urban_pop"].mean())

df["gni_per_capita"] = df["gni_per_capita"].fillna(df["gni_per_capita"].mean())

df["gdp_growth"] = df["gdp_growth"].fillna(df["gdp_growth"].mean())

df["life_exp"] = df["life_exp"].fillna(df["life_exp"].mean())



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.